import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询服务项目列表
export function listProject(data) {
  return request({
    url: '/market/project/projectList',
    method: 'post',
    data: data
  })
}

// 查询服务项目详细
export function getProject(projectId) {
  return request({
    url: '/market/project/' + parseStrEmpty(projectId),
    method: 'get'
  })
}

// 新增服务项目
export function addProject(data) {
  return request({
    url: '/market/project',
    method: 'post',
    data: data
  })
}

// 修改服务项目
export function updateProject(data) {
  return request({
    url: '/market/project',
    method: 'put',
    data: data
  })
}

// 删除服务项目
export function delProject(projectId) {
  return request({
    url: '/market/project/' + projectId,
    method: 'delete'
  })
}

// 服务项目状态修改
export function changeProjectStatus(projectId, status) {
  const data = {
    projectId,
    status
  }
  return request({
    url: '/market/project/projectChangeStatus',
    method: 'put',
    data: data
  })
}

// 随机单是否可用
export function changeProjectIsAble(projectId, isAble) {
  const data = {
    projectId,
    isAble
  }
  return request({
    url: '/market/project/projectChangeIsAble',
    method: 'put',
    data: data
  })
}

// 查询服务项目下拉树结构
export function projectTreeSelect() {
  return request({
    url: '/market/project/projectTree',
    method: 'get'
  })
}
